#ifndef _ODN_INPUT_H
#define _ODN_INPUT_H

#include "odn_inp_InputReceiver.h"
#include "odn_Element.h"

//Utility headers
#include "odn_util_Vector3D.h"

using ouden::utility::Vector3D;

namespace ouden
{
	namespace input
	{
		
		
		class ODN_InputManager //: public ODN_Element
		{
		
		public:
			
			//Constructor and destructor
			ODN_InputManager()		{}
			~ODN_InputManager()		{}
			
			//Retrieve all input from the user 
			void		 	retrieveInput();
			
			//Register a new InputReceiver 
			void 			addInputReceiver(ODN_InputReceiver* r)		{ inputreceivers.push_back(r); }
		
			//Mouse movement
			Vector3D 		getMousePos()					{ return mousepos; }	//get the mouse position
			Vector3D 		getMouseMoveVector()			{ return mousevector; }
			float			getMouseMoveAngle()				{ return mouseangle; }
			//float 			getMouseMoveDistance()			{ return mousedistance; }
			//bool 			isMouseMoved()					{ return mousedistance; }
		
			//Key presses (includes mouse clicks)
			bool 			getKeyState(unsigned char Key)	{ return keys[Key]; }	//Get the state of a specific key
			bool 			isKeyDown(unsigned char Key)	{ return (!oldkeys[Key] && keys[Key]); }
			bool 			isKeyUp(unsigned char Key)		{ return (oldkeys[Key] && !keys[Key]); }
		
		private:
			
			//Array of InputReceivers
			std::vector<ODN_InputReceiver*> inputreceivers;
			
			bool oldkeys[256];		//Old state of all the keys
			bool keys[256];			//State of all the keys
			Vector3D mousepos;		//Position of the mouse
			Vector3D mouseoldpos;	//Old position of the mouse
			Vector3D mousevector;	//Vector of last mouse movement
			//float mousedistance;	//Distance the mouse moved
			float mouseangle;		//Direction the mouse moved in
		
		};
		
	} //namespace input
} //namespace ouden

#endif //_ODN_INPUT_H
